package top.csjss.hospital.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import top.csjss.hospital.entity.SysMenu;
import top.csjss.hospital.entity.SysUser;
import top.csjss.hospital.entity.SysUserExample;

public interface SysUserMapper {
    long countByExample(SysUserExample example);

    int deleteByExample(SysUserExample example);

    int deleteByPrimaryKey(Integer userId);

    int insert(SysUser record);

    int insertSelective(SysUser record);

    List<SysUser> selectByExample(SysUserExample example);

    SysUser selectByPrimaryKey(Integer userId);

    int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example);

    int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example);

    int updateByPrimaryKeySelective(SysUser record);

    int updateByPrimaryKey(SysUser record);

    /**
     * 根据用户id查询侧边栏菜单
     * @param userId
     * @return
     */
    List<SysMenu> findByUserId(@Param("userId")Integer userId);

    /**
     * 根据用户id查询角色id
     * @param userid
     * @return
     */
    List<Integer> findUserRoleIdByUserId(Integer userid);

    /**
     * 添加角色信息
     * @param userid
     * @param ids
     * @return
     */
    int saveUserRole(@Param("userId") Integer userid, @Param("roleIds") Integer[] ids);
}
